/**
 * security panel builed the all security handle ---
 */
Ext.Loader.setConfig({
	enabled: true,
	paths   : {
		'Ext.ux' : '../../js/ux'
	}			
});

Ext.define('vsg.framework.ProxyWindow', {
	mixins: {
		observable: 'Ext.util.Observable'
	},
	proxyWindow : parent.window,
	requires: ['Ext.window.Window' ,
	 'Ext.ux.IFrame',
	 'Ext.ux.SimpleIFrame',
	 'Ext.ux.ManagedIFrame'],
	
	// --- provide  window ---
	_privateProxyWin:null,
    constructor: function(config) {
        
		var me = this;
		me.mixins.observable.constructor.call(me, config);
		
		
		var conCopy = config;
		var url = config.url;
		if (config.url != null && config.url.substring(0,8) != "http://") {
			var lastSeperator = window.location.href.lastIndexOf("/");
			var currentLoc = window.location.href.substring(0 , lastSeperator);
			url = currentLoc + "/" + url;
		}
		
		var innerPanel = me.createIframePanel(url,"parentId");

		conCopy.items = [innerPanel];

		me._privateProxyWin = new me.proxyWindow.Ext.create("Ext.window.Window", conCopy);
					
	},
	
	createIframePanel:function(url, frameId) {
		var innerFrame = {
			xtype:'simpleiframe',
			id:frameId,
			frame:true,
			region:'center',
			bodyBorder:false,
			src:url
		};
		
		return innerFrame;
		
		
	},
	
	
	isVisible:function() {
		var me = this;
		return me._privateProxyWin.isVisible();
	},
	
	show:function() {
		var me = this;
		me._privateProxyWin.show();
	}
	
	

});